<%= form_tag compare_external_works_path, :method => :get do %>
    <fieldset>
      <legend>Search for external works</legend>
      <p>
        <%= label_tag :external_work_url %>: 
        <%= text_field_tag :external_work_url, params[:external_work_url] %>
        <%= autocomplete_text_field "external_work_url", :no_comma => true %>
        <%= submit_tag t('.forms.search', :default => 'Search') %>
      </p>
  </fieldset>
<% end %>

<% unless @external_works.blank? %>
  <%= form_tag merge_external_works_path, :method => :post do %>
  
  <ol class="work index">
  <% for external_work in @external_works %>
    <li>
      <%= render :partial => 'external_works/blurb', :locals => {:external_work => external_work} %>
      <dl>
        <dt>Merge other external works to this one</dt>
        <dd><%= radio_button_tag "merger_id", external_work.id %></dd>

        <dt>Merge this external work to another one</dt>
        <dd><%= check_box_tag "to_merge[]", external_work.id %></dd>      
      </dl>
    </li>
  <% end %>
  </ol>
  <p><%= submit_tag %></p>
  <% end %>
<% end %>